home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7556 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: yama.mcc.ac.uk!usenet
  2. From: Dan <dan@ap.co.umist.ac.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Call by ref of int's
  5. Date: Tue, 27 Feb 1996 13:22:22 +0000
  6. Organization: umist
  7. Message-ID: <3133058E.41C67EA6@ap.co.umist.ac.uk>
  8. NNTP-Posting-Host: engels.ap.co.umist.ac.uk
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 2.0 (X11; I; SunOS 4.1.3_U1 sun4c)
  13.  
  14. I have a problem with my program;
  15.  
  16. I am writing a 3d engine and I have to read in from a txt file into
  17. a struct, and push each struct onto a stack.
  18.  
  19. When I pop the stack, I call;
  20.  
  21.     pop_facet(&facet_current, &a, &b, &c)
  22.  
  23. where facet_current is        struct facet
  24.                 {
  25.                    int edge[3][2];
  26.                    struct facet *next_f;
  27.                 }
  28.  
  29. and the in the actual function;
  30.  
  31. void pop_facet(struct facet **facet_current, int *a, int *b, int *c)
  32. {
  33. .
  34. .
  35. .
  36. *a = new_facet->edge[0][0];
  37. *b = new_facet->edge[0][1];    these will only be between 1 and 8
  38. *c = new_facet->edge[1][0];
  39. }
  40.  
  41. the problem is the &a,b,c 's i get don't produce meaningful numbers
  42. from an array vertex[8][3]
  43.  
  44. vertex[(a-1)][0]
  45. vertex[(a-1)][1] 
  46. .
  47.  
  48. vertex[(b-1)][0]
  49. .
  50. .
  51. etc...
  52.  
  53. the array vertex should only have +50 or -50 in any element but I keep
  54. getting results like -9843  and 12343
  55.  
  56. what's going on???
  57. ---------------------------------
  58. dan@ap.co.umist.ac.uk        
  59.                 
  60. "If all the world's a stage....    
  61.  then Steven Fry's f***ed!!"    
  62.                 
  63. GAME ON!            
  64. ---------------------------------
  65.